#include "paramsidmanager.h"

QMutex ParamsIDManager::mutex;
ParamsIDManager *ParamsIDManager::instance = nullptr;

quint32 ParamsIDManager::getNewID() {
    QMutexLocker locker(&mutex);
    if (instance == nullptr) {
        instance = new ParamsIDManager(nullptr);
    }
    return instance->nextID++;
}

ParamsIDManager::ParamsIDManager(QObject *parent) : QObject(parent), nextID(1) {

}

ParamsIDManager::~ParamsIDManager() {
    delete instance;
}
